package architect;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.concurrent.TimeUnit;

/**
 * 服务消费者启动类
 *
 * @author guanxin
 * @date 2018/4/18 10:56
 */

@EnableZuulProxy
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayZuulApp implements CommandLineRunner {

    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(GatewayZuulApp.class, args);
        TimeUnit.MINUTES.sleep(60);
        System.err.println("Gateway Zuul=============>>>>>>>>>>>>>服务关闭");
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("Gateway Zuul=============>>>>>>>>>>>>>启动完毕");
    }

    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
